<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body></body>
  <script>
    // 对象代理
    const xh = { name: "xiaohui" };
    const proxy = new Proxy(xh, {
      get(obj, property) {
        return obj[property]
      },
      set(obj,property,value){
          obj[property]=value;
          return true;
      }
    });
    console.log(proxy.name);
    proxy.name='刘辉';
    console.log(proxy.name);
    console.log(proxy);
    
    
  </script>
</html>
